<div id="tabs">

<form class="form-horizontal" id="ae_form" action="/pg/ac_Segnalazione/Create" method="post" enctype=multipart/form-data  role="form">
    <fieldset>
<input type="hidden" name="id" value="{{pageData['dao'].id}}"/>
<ul>
<li><a href="#tabs-1" title="Informazioni principali ed obbligatorie">Dati principali</a></li>
<li><a href="#tabs-2" title="foto">Storico</a></li>
</ul>
<!-- TAB 1 -->
<div id="tabs-1">
    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" >Numero:</label>
        <div class="col-sm-5 col-lg-5">
            <p class="form-control-static">{{pageData["dao"].numero|nonone}}</p>
        </div>
    </div>

    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="denominazione">Denominazione:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="denominazione" name="denominazione" value='{{pageData["dao"].denominazione|nonone}}' />
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" for="id_tipo_segnalazione" >Tipologia:</label>
        <div class="col-sm-8 col-lg-8">
            <select id="id_tipo_segnalazione" name="id_tipo_segnalazione" class="validate[required]">
                {% for t in pageData['tiposegnalazione'] %}
                    <option value="{{t.id}}" {{ 'selected="selected"' if t.id == pageData["dao"].id_tipo_segnalazione}}  >{{t.denominazione}} </option>
                {% endfor %}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" for="id_tipo_segnalazione" >Priorità :</label>
        <div class="col-sm-5 col-lg-5">
            <select id="id_priorita_segnalazione" name="id_priorita_segnalazione" class="validate[required]">
                {% for t in pageData['prioritasegnalazione'] %}
                    <option value="{{t.id}}" {{ 'selected="selected"' if t.id == pageData["dao"].id_priorita_segnalazione}}  >{{t.denominazione}} </option>
                {% endfor %}
            </select>
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="descrizione">Descrizione</label>
        <div class="col-sm-7 col-lg-7">
            <textarea class="form-control" type="text" id="descrizione "name="descrizione" rows=20" cols="85">{{pageData['dao'].descrizione|nonone}}</textarea>
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="immagine">Immagine allegata:</label>
        <div class="col-sm-5 col-lg-5">
                {% if pageData['dao'].immagine %}
            <div class="fileinput fileinput-exists" data-provides="fileinput">
                {% else %}
            <div class="fileinput fileinput-new" data-provides="fileinput">
                {% endif %}
                <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 150px;height:150px;">
                    <img class="img-thumbnail img-responsive" src="data:image/png;base64,{{pageData['dao'].immagine}}" alt="immagine"  />
                </div>
                <div>
                    <span class="btn btn-danger btn-file">
                    <span class="fileinput-new">Seleziona</span>
                    <span class="fileinput-exists">Cambia</span>
                        <input class="" type="file" name="immagine" id="immagine">
                    </span>
                        <a href="#" class="btn btn-info fileinput-exists" data-dismiss="fileinput">Rimuovi</a>
                </div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" >Data inserimento:</label>
        <div class="col-sm-5 col-lg-5">
            <p class="form-control-static">{{pageData["dao"].registration_date|nonone|datetimeformat}}</p>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" >Ultima modifica:</label>
        <div class="col-sm-5 col-lg-5">
            <p class="form-control-static">{{pageData["dao"].last_modified|nonone|datetimeformat}}</p>
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="lat">Lat:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="lat" name="lat" value='{{pageData["dao"].lat|nonone}}' />
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="lng">Long:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="lng" name="lng" value='{{pageData["dao"].lng|nonone}}' />
        </div>
    </div>




        <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" for="id_stato_segnalazione" >Stato :</label>
        <div class="col-sm-5 col-lg-5">
            <select id="id_stato_segnalazione" name="id_stato_segnalazione" class="validate[required]">
                {% for t in pageData['statosegnalazione'] %}
                    <option value="{{t.id}}" {{ 'selected="selected"' if t.id == pageData["dao"].id_stato_segnalazione}}  >{{t.denominazione}} </option>
                {% endfor %}
            </select>
        </div>
    </div>



</div>
<!-- fine TAB 1 -->
<!-- TAB2 -->
<div id="tabs-2">
    <p>Qui ci lo storico della nostra segnalazione</p>
</div>
</fieldset>
<div class="form-group" title="Bottoni di salvataggio e reset del form">
        <div class="col-sm-5 col-lg-5 col-sm-offset-2">
            <input class="btn btn-default" type="submit" value="Salva" name="add"/>
            <input class="btn btn-default" type="button" value="Chiudi" name="chiudi" id="chiudi_edit"/>
        </div>
    </div>

</form>
</div>
<script type="text/javascript" src="/tpl/pg/js/plugins/tinymce/tiny_mce.js"></script>
<script type="text/javascript" src="/tpl/pg/js/plugins/tinymce/jquery.tinymce.js"></script>
<script>
  $(document).ready(function(){

$( "#ae_form" ).validationEngine({
                    prettySelect : true,
                    useSuffix: "_chosen",
                });
$( "#id_tipo_segnalazione" ).chosen({
                    width: '50%',
                    disable_search:true,
                    allow_single_deselect: true})
$( "#id_priorita_segnalazione" ).chosen({
                    width: '50%',
                    disable_search:true,
                    allow_single_deselect: true})
$( "#id_stato_segnalazione" ).chosen({
                    width: '50%',
                    disable_search:true,
                    allow_single_deselect: true})
$( "#tabs" ).tabs();
$("#data_nascita").datepicker({ changeMonth: true, changeYear: true, dateFormat:"dd/mm/yy",});
$("#data_nascita").datepicker( $.datepicker.regional[ "it" ] );

$('textarea').tinymce({
    theme : "advanced",
    plugins :"safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,media,searchreplace,contextmenu,paste,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,|,forecolor,backcolor",
     theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr",
     //theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,
    convert_urls : false,

        // Replace values for the template plugin
        template_replace_values : {
                username : "Some User",
                staffid : "991234"
        }
    });

});
</script>
